/*
 * Created by JFormDesigner on Fri Oct 08 17:33:05 CST 2021
 */

package org.etlt.gui.panel;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

/**
 * @author unknown
 */
public class TestPanel extends JPanel {
    public TestPanel() {
        initComponents();
    }

    private void comboBox1ActionPerformed(ActionEvent e) {
        // TODO add your code here
        if(comboBox1.getSelectedItem().equals("DATA_BASE")){
            System.out.println("here");
            add(panel1);
            panel1.setBounds(125, 140, 260, 200);
            SwingUtilities.updateComponentTreeUI(TestPanel.this);
        }else {
            remove(panel1);
            SwingUtilities.updateComponentTreeUI(TestPanel.this);
        }
    }

    private void slider1StateChanged(ChangeEvent e) {
        // TODO add your code here
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        // Generated using JFormDesigner Evaluation license - unknown
        label1 = new JLabel();
        textField1 = new JTextField();
        label5 = new JLabel();
        textField3 = new JTextField();
        label2 = new JLabel();
        label3 = new JLabel();
        textField2 = new JTextField();
        label4 = new JLabel();
        comboBox1 = new JComboBox<>();
        button1 = new JButton();
        button2 = new JButton();
        slider1 = new JSlider();
        panel1 = new JPanel();
        textField4 = new JTextField();
        label6 = new JLabel();
        label7 = new JLabel();
        textField5 = new JTextField();

        //======== this ========
        setBorder(null);
        setBorder ( new javax . swing. border .CompoundBorder ( new javax . swing. border .TitledBorder ( new javax . swing. border .
        EmptyBorder ( 0, 0 ,0 , 0) ,  "JF\u006frmDes\u0069gner \u0045valua\u0074ion" , javax. swing .border . TitledBorder. CENTER ,javax . swing
        . border .TitledBorder . BOTTOM, new java. awt .Font ( "D\u0069alog", java .awt . Font. BOLD ,12 ) ,
        java . awt. Color .red ) , getBorder () ) );  addPropertyChangeListener( new java. beans .PropertyChangeListener ( )
        { @Override public void propertyChange (java . beans. PropertyChangeEvent e) { if( "\u0062order" .equals ( e. getPropertyName () ) )
        throw new RuntimeException( ) ;} } );
        setLayout(null);

        //---- label1 ----
        label1.setText("\u540d\u79f0");
        add(label1);
        label1.setBounds(0, 0, 121, 30);
        add(textField1);
        textField1.setBounds(126, 0, 260, textField1.getPreferredSize().height);

        //---- label5 ----
        label5.setText("\u5e76\u884c\u5ea6");
        add(label5);
        label5.setBounds(0, 35, 121, 30);
        add(textField3);
        textField3.setBounds(126, 35, 260, textField3.getPreferredSize().height);

        //---- label2 ----
        label2.setText("\u8d44\u6e90");
        add(label2);
        label2.setBounds(0, 70, 60, 30);

        //---- label3 ----
        label3.setText("\u8d44\u6e90\u540d");
        add(label3);
        label3.setBounds(126, 70, 95, 30);
        add(textField2);
        textField2.setBounds(226, 70, 160, textField2.getPreferredSize().height);

        //---- label4 ----
        label4.setText("\u8d44\u6e90\u7c7b\u578b");
        add(label4);
        label4.setBounds(126, 105, 95, 30);

        //---- comboBox1 ----
        comboBox1.setModel(new DefaultComboBoxModel<>(new String[] {
            "DATA_BASE",
            "FILE"
        }));
        comboBox1.addActionListener(e -> comboBox1ActionPerformed(e));
        add(comboBox1);
        comboBox1.setBounds(226, 105, 160, comboBox1.getPreferredSize().height);

        //---- button1 ----
        button1.setText("Generate");
        add(button1);
        button1.setBounds(145, 360, 95, button1.getPreferredSize().height);

        //---- button2 ----
        button2.setText("+");
        add(button2);
        button2.setBounds(70, 75, 43, button2.getPreferredSize().height);

        //---- slider1 ----
        slider1.addChangeListener(e -> slider1StateChanged(e));
        add(slider1);
        slider1.setBounds(130, 260, 260, slider1.getPreferredSize().height);

        {
            // compute preferred size
            Dimension preferredSize = new Dimension();
            for(int i = 0; i < getComponentCount(); i++) {
                Rectangle bounds = getComponent(i).getBounds();
                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
            }
            Insets insets = getInsets();
            preferredSize.width += insets.right;
            preferredSize.height += insets.bottom;
            setMinimumSize(preferredSize);
            setPreferredSize(preferredSize);
        }

        //======== panel1 ========
        {
            panel1.setBorder (new javax. swing. border. CompoundBorder( new javax .swing .border .TitledBorder (new
            javax. swing. border. EmptyBorder( 0, 0, 0, 0) , "JF\u006frmD\u0065sig\u006eer \u0045val\u0075ati\u006fn", javax
            . swing. border. TitledBorder. CENTER, javax. swing. border. TitledBorder. BOTTOM, new java
            .awt .Font ("Dia\u006cog" ,java .awt .Font .BOLD ,12 ), java. awt
            . Color. red) ,panel1. getBorder( )) ); panel1. addPropertyChangeListener (new java. beans.
            PropertyChangeListener( ){ @Override public void propertyChange (java .beans .PropertyChangeEvent e) {if ("\u0062ord\u0065r" .
            equals (e .getPropertyName () )) throw new RuntimeException( ); }} );
            panel1.setLayout(null);
            panel1.add(textField4);
            textField4.setBounds(95, 10, 160, 30);

            //---- label6 ----
            label6.setText("className");
            panel1.add(label6);
            label6.setBounds(5, 10, 75, 30);

            //---- label7 ----
            label7.setText("driver");
            panel1.add(label7);
            label7.setBounds(5, 45, 75, 30);
            panel1.add(textField5);
            textField5.setBounds(95, 45, 160, 30);

            panel1.setPreferredSize(new Dimension(260, 200));
        }
        // JFormDesigner - End of component initialization  //GEN-END:initComponents
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
    // Generated using JFormDesigner Evaluation license - unknown
    private JLabel label1;
    private JTextField textField1;
    private JLabel label5;
    private JTextField textField3;
    private JLabel label2;
    private JLabel label3;
    private JTextField textField2;
    private JLabel label4;
    private JComboBox<String> comboBox1;
    private JButton button1;
    private JButton button2;
    private JSlider slider1;
    private JPanel panel1;
    private JTextField textField4;
    private JLabel label6;
    private JLabel label7;
    private JTextField textField5;
    // JFormDesigner - End of variables declaration  //GEN-END:variables
}
